﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{
    public class PersonCol
    {
        
        /******* Atributter *******/
        
        private List<Person> personCol;


        /******* Constructor *******/

        public PersonCol()
        { 
        personCol = new List<Person>();        
        }

        /******** Metoder ********/
        public void OpretPerson(Person p)
        {
        personCol.Add(p);        
        }

        public Person HentPerson(int cprnr)
        {
            foreach (Person p in personCol)
            {
                if (p.Cprnr == cprnr)
                {
                    return p;
                }
            }
            return null;        
        }

        public void RedigerePerson(string navn, int cprnr, Adresse adr1, Adresse adr2, int telfnr)
        {
            Person p = HentPerson(cprnr);
            p.Navn = navn;
            p.Cprnr = cprnr;
            p.Adr1 = adr1;
            p.Adr2 = adr2;
        }
    }
}
